package com.woniu.mealsService.consumer;

import com.woniu.mealsService.service.OrderProductService;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author jiang
 */
@Component
@RabbitListener(queues = "refund_order")
public class RefundConsumer {
    @Autowired
    private OrderProductService orderProductService;
    @RabbitHandler
    public void refundOrder(String orderId) throws Exception {
        try {
            orderProductService.refundOrder(orderId);
        }catch (Exception e){
            throw e;
        }
    }
}
